package controller.api;
import com.jfinal.aop.Before;
import com.jfinal.aop.Inject;
import com.jfinal.kit.Kv;
import com.jfinal.kit.Ret;

import common.inter.ServicerStationInter;
import common.inter.StaffStationInter;
import model.ModifyRecord;
import service.ModifyRecordService;

public class ApiModifyRecordController extends BaseApiController {
	@Inject ModifyRecordService modifyRecordService ;

	@Before(ServicerStationInter.class)
	public void list() {
	    Kv kv = getParamKv() ;
	    kv.set("tmr.stationId", getStation().getId());
	    Integer pageNumber = getParaToInt("pageNumber", 1);
	    Integer pageSize = getParaToInt("pageSize", 10);
	    set("page", modifyRecordService.getApiPage( kv , pageNumber, pageSize));
	    renderJson();
	}
	
	@Before(StaffStationInter.class)
	public void save() {
		ModifyRecord modifyRecord = getModel(ModifyRecord.class , "x");
        Ret ret = modifyRecordService.save(modifyRecord , getStaff() , getStation() );
        renderJson(ret);
	}
}
